import { bitmap2vector } from 'bitmap2vector'
import fs from 'fs'
import path from 'path'
import imagetracerjs from 'imagetracerjs'

const svgDir = path.resolve('resources', 'svg')
const pngDir = path.resolve('resources', 'png')

/**
 * @param {string} fileName 图标名称
 */
async function genSvg(fileName) {
  const svg = await bitmap2vector({
    input: fs.readFileSync(path.join(pngDir, fileName)),
  })
  fs.writeFileSync(path.join(svgDir, fileName.replace('.png', '.svg')), svg.content)
}

genSvg('image.png')